<?php
/*
 * Created on 01.02.2006
 *
 */

/**
 * Params:
 * name required
 * value required; if type == list parsed into array; syntax: value1;value2;val\;ue3 
 *      parsed to array('value1', 'value2', 'val;ue3') 
 * type possible values: list; if type != list value treated as scalar value else 
 *      parsed to array
 * 
 * values configured here are available via env->getConfig or configScope (in PSP)
 */
class conf_paramHandler
{

    function startElement (& $sender, $attrs, $line)
    {
        if (!$attrs['name'] || !$attrs['value'])
        {
            die("Config Error: Param ".$attrs['name'].':'.$attrs['value']." misses name or value!");
        }
        if ($attrs['type'] == "'list'")
        {
            $sender->appendCode('$config['.$attrs['name'].'] = preg_split("/(?<!\\\\\\);/", '.$attrs['value'].");\n");
        }
        else
        {
            $sender->appendCode('$config['.$attrs['name'].'] = '.$attrs['value'].";\n");
        }
    }
    
    function endElement (& $sender)
    {
    }

}
?>